<template>
  <div id="client">
    <p style="margin-bottom: 20px">
      请输入：
      <el-input
        style="width: 200px; margin-left: 10px; margin-right: 10px"
        placeholder="请输入单据编号或客户名"
        v-model="zonginput"
        clearable
      >
      </el-input>
      &nbsp;&nbsp;
      <span class="demonstration" style="margin-left: 20px">日期：</span>
      <el-date-picker
        v-model="youxiaodate"
        type="daterange"
        align="right"
        unlink-panels
        range-separator="至"
        start-placeholder="开始"
        end-placeholder="结束"
        :picker-options="pickerOptions"
        style="width: 180px"
      >
      </el-date-picker>
      &nbsp;&nbsp;&nbsp; 销售人员：<el-input
        style="width: 200px; margin-left: 10px; margin-right: 20px"
        placeholder="请输入销售人员"
        v-model="saleman"
        clearable
      >
      </el-input
      ><el-dropdown>
        <span class="el-dropdown-link">
          <i class="el-icon-arrow-down el-icon--right"></i>
        </span>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item>黄金糕</el-dropdown-item>
          <el-dropdown-item>狮子头</el-dropdown-item>
          <el-dropdown-item>螺蛳粉</el-dropdown-item>
          <el-dropdown-item disabled>双皮奶</el-dropdown-item>
          <el-dropdown-item divided>蚵仔煎</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

      <el-dropdown @command="handleCommand">
        <span class="el-dropdown-link">
          收款状态<i class="el-icon-arrow-down el-icon--right"></i>
        </span>
        <el-dropdown-menu slot="dropdown">
          <el-checkbox-group v-model="selectedOptions">
            <el-checkbox
              v-for="option in options"
              :label="option"
              :key="option"
              >{{ option }}</el-checkbox
            >
          </el-checkbox-group>
        </el-dropdown-menu>
      </el-dropdown>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <el-dropdown @command="handleCommand">
        <span class="el-dropdown-link">
          退货状态<i class="el-icon-arrow-down el-icon--right"></i>
        </span>
        <el-dropdown-menu slot="dropdown">
          <el-checkbox-group v-model="selectedOptions">
            <el-checkbox
              v-for="option in options"
              :label="option"
              :key="option"
              >{{ option }}</el-checkbox
            >
          </el-checkbox-group>
        </el-dropdown-menu>
      </el-dropdown>
      &nbsp;&nbsp;
    </p>
    <p style="">
      仓库：<el-input
        style="width: 200px; margin-left: 10px; margin-right: 20px"
        placeholder="请输入仓库"
        v-model="ck"
        clearable
      ></el-input>
      <el-button
        style="margin-left: -20px; margin-right: 10px"
        @click="dialogFormVisible = true"
        >...</el-button
      >
      &nbsp;&nbsp;&nbsp; 商品：<el-input
        style="width: 200px; margin-left: 10px; margin-right: 20px"
        placeholder="请输入商品"
        v-model="goods"
        clearable
      ></el-input>
      <el-button
        style="margin-left: -20px; margin-right: 10px"
        @click="dialogFormVisible1 = true"
        >...</el-button
      >&nbsp;&nbsp;&nbsp; 审核状态<el-input
        style="width: 200px; margin-left: 10px; margin-right: 20px"
        placeholder="请输入审核状态"
        v-model="shenhe"
        clearable
      >
      </el-input
      ><el-dropdown>
        <span class="el-dropdown-link">
          <i class="el-icon-arrow-down el-icon--right"></i>
        </span>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item>已审核</el-dropdown-item>
          <el-dropdown-item>未审核</el-dropdown-item>
        </el-dropdown-menu> </el-dropdown
      >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <el-button type="primary">查询</el-button>
    </p>
    <el-divider></el-divider>
    <div style="margin-bottom: 20px; margin-right: 20px; float: right">
      <el-button type="primary" @click="goto('SaleOrder')">新增</el-button
      >&nbsp;&nbsp;&nbsp;
      <el-button type="success">审核</el-button>&nbsp;&nbsp;&nbsp;
      <el-button type="warning">反审核</el-button>&nbsp;&nbsp;&nbsp;
      <el-button type="danger">删除</el-button>&nbsp;&nbsp;&nbsp;
      <el-button type="primary">批量导入</el-button>&nbsp;&nbsp;&nbsp;
    </div>

    <div class="client-content">
      <el-table
        height="350px"
        :data="tableData"
        border
        style="width: 100%; font-size: 13px"
      >
        <el-table-column type="selection" width="55"> </el-table-column>
        <el-table-column prop="date" label="单据日期" width="150">
        </el-table-column>
        <el-table-column prop="ordersId" label="单据编号" width="120">
        </el-table-column>
        <el-table-column prop="orderId" label="关联源销货单号" width="120">
        </el-table-column>
        <el-table-column prop="want" label="关联销货退货单号" width="120">
        </el-table-column>
        <el-table-column prop="type" label="客户类别" width="120">
        </el-table-column>
        <el-table-column prop="client" label="客户" width="120">
        </el-table-column>
        <el-table-column prop="totalmoney" label="销售金额" width="120">
        </el-table-column>
        <el-table-column prop="discount" label="优惠后金额" width="120">
        </el-table-column>
        <el-table-column prop="getMoney" label="已收款" width="120">
        </el-table-column>
        <el-table-column prop="getType" label="收款状态" width="120">
        </el-table-column>
        <el-table-column prop="goType" label="退货状态" width="120">
        </el-table-column>
        <el-table-column prop="num" label="数量" width="120"> </el-table-column>
        <el-table-column prop="subdate" label="收款到期日" width="120">
        </el-table-column>
        <el-table-column prop="doman" label="制单人" width="120">
        </el-table-column>
        <el-table-column prop="goman" label="审核人" width="120">
        </el-table-column>
        <el-table-column prop="mytext" label="备注" width="120">
        </el-table-column>
        <el-table-column prop="submethod" label="交货方式" width="120">
        </el-table-column>
        <el-table-column prop="gocompany" label="物流公司" width="120">
        </el-table-column>
        <el-table-column prop="gogogo" label="关联物流订单号" width="120">
        </el-table-column>
        <el-table-column prop="weight" label="重量" width="120">
        </el-table-column>
        <el-table-column fixed="right" label="操作" width="100">
          <template slot-scope="scope">
            <el-button @click="handleClick(scope.row)" type="text" size="small"
              >查看</el-button
            >
            <el-button type="text" size="small">编辑</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>

    <div style="width: 100%; background-color: blanchedalmond; height: 30px">
      <table style="width: 78.7%; height: 30px">
        <tr>
          <td style="width: 50%">合计：</td>
          <td style="width: 50%">123</td>
        </tr>
      </table>
    </div>
    <el-pagination
      style="position: relative; left: 700px; top: 10px; right: 50px"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage4"
      :page-sizes="[100, 200, 300, 400]"
      :page-size="100"
      layout="total, sizes, prev, pager, next, jumper"
      :total="400"
    >
    </el-pagination>
    <el-dialog top="20px" title="选择仓库" :visible.sync="dialogFormVisible">
      <el-input
        v-model="input"
        placeholder="请输入编号或名称"
        style="width: 200px; margin-left: 20px"
      ></el-input>
      <el-checkbox v-model="checked" style="margin-left: 20px"
        >显示禁用仓库</el-checkbox
      >
      <el-button type="success" style="margin-left: 20px">查询</el-button>
      <el-table :data="gridData">
        <el-table-column type="selection" width="55"> </el-table-column>
        <el-table-column
          width="100"
          property="id"
          label="编号"
        ></el-table-column>
        <el-table-column
          width="100"
          property="name"
          label="名称"
        ></el-table-column>
      </el-table>
      <div class="block">
        <span class="demonstration"></span>
        <el-pagination layout="prev, pager, next" :total="1000">
        </el-pagination>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogFormVisible = false"
          >确 定</el-button
        >
      </div>
    </el-dialog>
    <el-dialog top="20px" title="选择商品" :visible.sync="dialogFormVisible1">
      <el-input
        v-model="spid"
        placeholder="请输入编号或名称"
        style="width: 200px; margin-left: 20px"
      ></el-input
      >&nbsp;&nbsp; 仓库：<el-select
        v-model="ckid"
        placeholder="请选择"
        style="width: 100px"
      >
        <el-option
          v-for="item in ck"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option>
      </el-select>
      <el-checkbox v-model="checked" style="margin-left: 20px"
        >显示禁用商品</el-checkbox
      >
      <el-button type="success" style="margin-left: 20px">查询</el-button>
      <el-table :data="gridData1">
        <el-table-column type="selection" width="55"> </el-table-column>
        <el-table-column width="100" label="图片"></el-table-column>
        <el-table-column
          width="100"
          property="goodsId"
          label="商品编号"
        ></el-table-column>
        <el-table-column
          width="300"
          property="address"
          label="产地"
        ></el-table-column>
        <el-table-column
          width="100"
          property="property"
          label="辅助属性编号"
        ></el-table-column>
        <el-table-column
          width="100"
          property="name"
          label="商品名称"
        ></el-table-column>
        <el-table-column
          width="100"
          property="model"
          label="规格型号"
        ></el-table-column>
        <el-table-column
          width="100"
          property="type"
          label="商品类别"
        ></el-table-column>
        <el-table-column
          width="100"
          property="danwei"
          label="单位"
        ></el-table-column>
        <el-table-column
          width="100"
          property="kc"
          label="库存"
        ></el-table-column>
        <el-table-column
          width="100"
          property="text"
          label="备注"
        ></el-table-column>
      </el-table>
      <div class="block">
        <span class="demonstration"></span>
        <el-pagination layout="prev, pager, next" :total="1000">
        </el-pagination>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible1 = false">取 消</el-button>
        <el-button type="primary" @click="dialogFormVisible1 = false"
          >确 定</el-button
        >
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: "SaleOrderList",
  data() {
    return {
      saleman: "",
      shenhe: "",
      goods: "",
      ck: "",
      youxiaodate: "",
      zonginput: "",
      gridData1: [
        {
          text: "备注",
          kc: "默认仓库",
          danwei: "个",
          type: "水果",
          model: "规格型号",
          name: "库尔勒香梨",
          address: "产地",
          goodsId: "123",
        },
        {
          text: "备注",
          kc: "默认仓库",
          danwei: "个",
          type: "水果",
          model: "规格型号",
          name: "库尔勒香梨",
          address: "产地",
          goodsId: "123",
        },
        {
          text: "备注",
          kc: "默认仓库",
          danwei: "个",
          type: "水果",
          model: "规格型号",
          name: "库尔勒香梨",
          address: "产地",
          goodsId: "123",
        },
        {
          text: "备注",
          kc: "默认仓库",
          danwei: "个",
          type: "水果",
          model: "规格型号",
          name: "库尔勒香梨",
          address: "产地",
          goodsId: "123",
        },
        {
          text: "备注",
          kc: "默认仓库",
          danwei: "个",
          type: "水果",
          model: "规格型号",
          name: "库尔勒香梨",
          address: "产地",
          goodsId: "123",
        },
        {
          text: "备注",
          kc: "默认仓库",
          danwei: "个",
          type: "水果",
          model: "规格型号",
          name: "库尔勒香梨",
          address: "产地",
          goodsId: "123",
        },
      ],
      dialogFormVisible1: false,
      gridData: [
        {
          name: "默认仓库",
          id: "123",
        },
        {
          name: "冷藏仓库",
          id: "1234",
        },
      ],
      dialogFormVisible: false,
      tableData: [
        {
          date: "2025-02-25",
          weight: 100,
          ordersId: "1433225",
          want: "1433224",
          type: "销货",
          sellman: "员工3",
          gocompany: "顺丰快递",
          submethod: "快递物流",
          goman: "员工1",
          doman: "员工2",
          num: 10,
          discount: 100,
          totalmoney: 200,
          buyid: "1433223",
          text: "备注",
          subdate: "2026-05-02",
        },
      ],
      checkAll: false,
      selectedOptions: [],
      options: ["未收款", "部分收款", "已收款"],
      isIndeterminate: false,
      dialogFormVisible: false,
    };
  },
  methods: {
    handleCheckedCitiesChange(value) {
      const checkedCount = value.length;
      this.checkAll = checkedCount === this.options.length;
      this.isIndeterminate =
        checkedCount > 0 && checkedCount < this.options.length;
    },
    goto(to) {
      if (this.$route.path !== "/" + to) {
        this.$router.push(to);
      }
    },
  },
  watch: {
    selectedOptions(value) {
      this.handleCheckedCitiesChange(value);
    },
  },
};
</script>

<style scoped>
.el-button el-button--default el-popover__reference {
  margin-right: 20px;
}

tr {
  border: 1px solid black;
}
.el-dropdown-link {
  cursor: pointer;
  color: #409eff;
}
.el-icon-arrow-down {
  font-size: 12px;
}
</style>